<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>Jstorm UI</title>
</h:head>

<h:body>
	<h:outputLink value="cluster.jsf">
		<h1>
			<h:outputText value="JStorm Cluster" />
			<f:param name="clusterName" value="#{param.clusterName}" />
		</h1>
	</h:outputLink>
	
	<h2>Supervisor Summary</h2>
	<h:form>
		<p:dataTable id="supervisorsummary" var="ssumm"
			value="#{supervisorpage.ssumm}" >
			<p:column>
				<f:facet name="header">
					<h:outputText value="Host" />
				</f:facet>
				<h:outputText value="#{ssumm.host}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="IP" />
				</f:facet>
				<h:outputText value="#{ssumm.ip}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Uptime" />
				</f:facet>
				<h:outputText value="#{ssumm.uptime}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Total Port" />
				</f:facet>
				<h:outputText value="#{ssumm.totalPort}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Used Port" />
				</f:facet>
				<h:outputText value="#{ssumm.usedPort}" />
			</p:column>
			
			<p:column>
				<f:facet name="header">
					<h:outputText value="Conf" />
				</f:facet>
            	<h:outputLink value="conf.jsf" target="_blank">
                    <h:outputText value="conf" />
                    <f:param name="clusterName" value="#{param.clusterName}" />
                    <f:param name="host" value="#{ssumm.ip}" />
                </h:outputLink>
			</p:column>
			
			<p:column>
				<f:facet name="header">
					<h:outputText value="Logs" />
				</f:facet>
            	<h:outputLink value="listlog.jsf" target="_blank">
                    <h:outputText value="logs" />
                    <f:param name="clusterName" value="#{param.clusterName}" />
                    <f:param name="host" value="#{ssumm.ip}" />
                </h:outputLink>
			</p:column>
			
		</p:dataTable>
	</h:form>
	
	<h2>Used Worker Summary</h2>
    <h:form>
        <p:dataTable id="workersummary" var="wsumm" value="#{supervisorpage.wsumm}"
	        sortBy="#{wsumm.port}" sortOrder="ASCENDING">
            <p:column>
                <f:facet name="header">
                    <h:outputText value="port" />
                </f:facet>
                <h:outputText value="#{wsumm.port}" />
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Uptime" />
                </f:facet>
                <h:outputText value="#{wsumm.uptime}" />
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Topology" />
                </f:facet>
                <h:outputText value="#{wsumm.topology}" />
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Task List" />
                </f:facet>
                <p:dataTable id="task" var="task"
                        value="#{wsumm.taskSummList}">
                    <p:column>
                        <h:outputLink value="#{task._component_type}.jsf">
                        <h:outputText value="#{task._component_id}-#{task._task_id}" />
                            <f:param name="clusterName" value="#{param.clusterName}" />
                            <f:param name="topologyid" value="#{wsumm.topology}" />
                            <f:param name="window" value="All-time" />
                            <f:param name="componentid" value="#{task._component_id}" />
                        </h:outputLink>
                    </p:column>
                </p:dataTable>
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Worker Log" />
                </f:facet>
                <h:outputLink value="log.jsf" target="_blank">
                   <h:outputText value="log" />
                   <f:param name="clusterName" value="#{param.clusterName}" />
                   <f:param name="host" value="#{param.host}" />
                   <f:param name="topologyId" value="#{wsumm.topology}" />
                   <f:param name="workerPort" value="#{wsumm.port}" />
                </h:outputLink>
            </p:column>
            
            <p:column>
                <f:facet name="header">
                    <h:outputText value="Worker JStack" />
                </f:facet>
                <h:outputLink value="jstack.jsf" target="_blank">
                   <h:outputText value="jstack" />
                   <f:param name="clusterName" value="#{param.clusterName}" />
                   <f:param name="host" value="#{param.host}" />
                   <f:param name="workerPort" value="#{wsumm.port}" />
                </h:outputLink>
            </p:column>
            
        </p:dataTable>
    </h:form>
    <h2>Worker Metrics</h2>
    <h:form>
        <p:dataTable id="workermetrics" var="wmetr" value="#{supervisorpage.workermetrics}"
	        sortBy="#{wmetr.port}" sortOrder="ASCENDING">
	    <p:column>
                <f:facet name="header">
                    <h:outputText value="Port" />
                </f:facet>
                <h:outputText value="#{wmetr.port}" />
            </p:column>
            
            <p:column>
                <f:facet name="header">
                    <h:outputText value="Used Cpu(%)" />
                </f:facet>
                <h:outputText value="#{wmetr.usedCpu}" />
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Used Mem(M)" />
                </f:facet>
                <h:outputText value="#{wmetr.usedMem}" />
            </p:column>

	    <p:column>
		<f:facet name="header">
                    <h:outputText value="Batch Trans Time over network(ms)" />
                </f:facet>
                <h:outputText value="#{wmetr.nettyservMsgTransTime}" />
             </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Msg Decode Time(ms)" />
                </f:facet>
                <h:outputText value="#{wmetr.nettyservDecodeTime}" />
	    </p:column>

	    <p:column>
		<f:facet name="header">
                    <h:outputText value="Dispatch Time(ms)" />
                </f:facet>
                <h:outputText value="#{wmetr.dispatchTime}" />
	    </p:column>

	    <p:column>
                <f:facet name="header">
		    <h:outputText value="Dispatch Queue(%)" />
                </f:facet>
                <h:outputText value="#{wmetr.dispatchQueue}" />
	    </p:column>

	    <p:column>
		<f:facet name="header">
                    <h:outputText value="Batch Tuple Time(ms)" />
                </f:facet>
                <h:outputText value="#{wmetr.batchTupleTime}" />
	    </p:column>

	    <p:column>
                <f:facet name="header">
		    <h:outputText value="Batch Tuple Queue(%)" />
                </f:facet>
                <h:outputText value="#{wmetr.batchTupleQueue}" />
	    </p:column>

            <p:column>
		<f:facet name="header">
		    <h:outputText value="Netty Client send Time(ms)" />
                </f:facet>
                <h:outputText value="#{wmetr.nettycliSendTime}" />
	    </p:column>

	    <p:column>
		<f:facet name="header">
                    <h:outputText value="Netty Send Pending Num" />
                </f:facet>
                <h:outputText value="#{wmetr.nettycliSendPending}" />
	    </p:column>

            <p:column>
		<f:facet name="header">
                    <h:outputText value="Netty Client Batch Size" />
                </f:facet>
                <h:outputText value="#{wmetr.nettycliBatchSize}" />
	    </p:column>

            <p:column>
		<f:facet name="header">
                    <h:outputText value="Netty Sync Batch Queue" />
                </f:facet>
                <h:outputText value="#{wmetr.nettycliSyncBatchQueue}" />
	    </p:column>

	    <p:column>
		<f:facet name="header">
                    <h:outputText value="Netty Sync Disr Queue" />
                </f:facet>
                <h:outputText value="#{wmetr.nettycliSyncDisrpQueue}" />
	    </p:column>

        </p:dataTable>
    </h:form>
</h:body>
</html>
